package chapter.seventh.item39;

import java.util.Date;

public final class Period {
	private final Date start;
	private final Date end;
	
	public Period(Date start,Date end){
		if(start.compareTo(end)>0)
			throw new IllegalArgumentException(start+" after "+end);
		this.start = new Date(start.getTime());//保护性拷贝
		this.end = new Date(end.getTime());
	}
	
	public Date start(){
		return new Date(start.getTime());
	}
	
	public Date end(){
		return new Date(end.getTime());
	}
}
